#ifndef MATRIX_H
#define MATRIX_H
#include <tinyxml.h>
#include "type.h"
#include "Point.h"

class Matrix {
public:
	Matrix();
	bool HasScale; ///< UB[1] Has scale values if equal to 1
	uint8 NScaleBits; ///< If HasScale = 1, UB[5] Bits in each scale value field
	float ScaleX; ///< If HasScale = 1, FB[NScaleBits] x scale value
	float ScaleY; ///< If HasScale = 1,  FB[NScaleBits] y scale value
	bool HasRotate; ///< UB[1] Has rotate and skew values if equ to 1
	uint8 NRotateBits; ///< If HasRotate = 1,  UB[5] Bits in each rotate value field
	float RotateSkew0; ///< If HasRotate = 1,  FB[NRotateBits]First rotate and skew value
	float RotateSkew1; ///< If HasRotate = 1,  FB[NRotateBits]Second rotate and skew value
	uint8 NTranslateBits; ///< UB[5] Bits in each translate value field
	int TranslateX; ///< SB[NTranslateBits] x translate value in twips
	int TranslateY; ///< SB[NTranslateBits] y translate value in twips
	static Matrix* from_file(FILE*f);
	void print();
	size_t size_in_file() {
		return size;
	}
	Point trans(Point p);
	virtual TiXmlElement* toTiXmlElement();
private:
	size_t size;
};

#endif
